package com.frank.big.service;

import com.frank.big.dto.BidataRequestDTO;
import com.frank.big.feignClient.BidataOnlineFeignClient;
import com.frank.big.mapper.EnterpriseRequestMapper;
import com.frank.big.model.BidataRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.cloud.openfeign.SpringQueryMap;
import org.springframework.stereotype.Service;

/**
 * @author 小石潭记
 * @date 2020/10/26 15:53
 * @Description: ${todo}
 */
@Service
public class EnterpriseInfoService {

    @Autowired
    private BidataOnlineFeignClient client;

    @Cacheable(cacheNames = "enterpriseInfo", key = "#bidataRequest.enterpriseId + '-' + #bidataRequest.enterpriseName")
    public Object getEnterpriseInfo(@SpringQueryMap BidataRequest bidataRequest) {
        BidataRequestDTO bidataRequestDTO = EnterpriseRequestMapper.MAPPER.toTarget(bidataRequest);
        return client.getEnterpriseInfo(bidataRequestDTO);
    }

}
